home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1379 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  48 lines

  1. Path: news.worldlinx.com!news
  2. From: "J. Christian Blanchette" <jblanc@ivic.qc.ca>
  3. Newsgroups: comp.lang.c
  4. Subject: tc++: vram 4 K segment warp-around ?
  5. Date: Fri, 12 Jan 1996 14:19:54 -0800
  6. Organization: WorldLinx Telecommunications Inc.
  7. Message-ID: <30F6DE8A.20CD@ivic.qc.ca>
  8. NNTP-Posting-Host: ppp05.ivic.qc.ca
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0b4a (Win95; I; 16bit)
  13.  
  14. /*
  15.    * help me!  i'm using tc++ 3.0, and the following code outputs:
  16.    *  p1 -> 3, p2 -> 3, p3 -> 3
  17.    * can someone explain me this 4 K warp-around?
  18.    *
  19.    * [ in fact, what i really intend is to use vram as a 1 K aligned
  20.    * buffer. if you have any other idea about how to achieve that (more
  21.    * portably, i hope), tell me! ]
  22.    */
  23.  
  24. #include <dos.h>
  25.  
  26. int main()
  27. {
  28. /* ptrs to video mem */
  29.   int far *p1 = (int far *) MK_FP(0xA000, 0x0000);
  30.   int far *p2 = (int far *) MK_FP(0xA000, 0x1000);
  31.   int far *p3 = (int far *) MK_FP(0xB000, 0x1000);
  32.  
  33.   *p1 = 1;
  34.   *p2 = 2;
  35.   *p3 = 3;
  36.  
  37.   printf("p1 -> %x, p2 -> %x, p3 -> %x\n", *p1, *p2, *p3);
  38.   return 0;
  39. }
  40.  
  41.   /*
  42.    * jblanc@ivic.qc.ca is j. christian blanchette
  43.    *
  44.    * "i still remember, why don't you?"
  45.    *   - e.v.
  46.    */
  47.  
  48.